<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- 高度坍塌是指父元素本来应该包括子元素的高度,但是实际上父元素比子元素的高度要小 -->
    <div class="container">
        <div class="box1"></div>
        <div class="box2"></div>
    </div>
</body>
<style>
    .container {
        margin-left: 50px;
        background: red;
    }

    .container::after {
        content: "";
        display: block;
    }
    .box1 {
        float: left;
        width: 200px;
        height: 200px;
        background-color: blue;
    }

    .box2 {
        width: 400px;
        height: 100px;
        background: cyan;
    }
</style>

</html>